// 2025/5/28
// kanan和高音

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for(auto& ai : a) cin >> ai;

    int left = 0, right = 1, ans = 0;
    while(right < n)
    {
        if(a[right] - a[right - 1] > 8)
        {
            ans = max(ans, right - left);
            left = right;
        }
        right++;
    }
    ans = max(ans, right - left);
    cout << ans << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")